﻿@using Microsoft.AspNet.Identity
@using Microsoft.AspNet.Identity.EntityFramework
@using SimpleSite.Models
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - My ASP.NET Application</title>
    @{
        var theme = Bootstrap.Theme.Stock;
        if (User.Identity.IsAuthenticated)
        {
            var userStore = new UserStore<ApplicationUser>(new ApplicationDbContext());
            var manager = new UserManager<ApplicationUser>(userStore);
            var user = manager.FindById(User.Identity.GetUserId());
            theme = user.CssTheme ?? theme;
        }
        @Styles.Render(Bootstrap.Bundle(theme))
    }
    @Scripts.Render("~/bundles/modernizr")

</head>
    <body>
        @RenderSection("topLevel", required: false)

        @*The structure for the navbar*@
        <div class="navbar navbar-inverse navbar-fixed-top">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        @*These get rendered out as the 'expand' button when collapsed*@
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    @Html.ActionLink("Application name", "Index", "Home", new { area = "" }, new { @class = "navbar-brand" })
                </div>
                <div class="navbar-collapse collapse">
                    @Html.Partial("_MenuPartial")
                    @Html.Partial("_LoginPartial")
                </div>
            </div>
        </div>
        <div class="container body-content">
            @{ Html.RenderPartial("_Alerts"); }
            @RenderBody()
            <hr />
            <footer>
                <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
            </footer>
        </div>

        @Scripts.Render("~/bundles/jquery")
        @*The Bootstrap JS is loaded here*@
        @*The JS takes care of some things that can't happen in pure CSS and adds functionality *@
        @Scripts.Render("~/bundles/bootstrap")
        @RenderSection("scripts", required: false)
    </body>
</html>
